<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.util.*,java.io.*,java.sql.*,java.text.*, dbAccess.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Patient Visitation</title>
<link rel="stylesheet" type="text/css" href="css_files/style.css" />
<style type="text/css">
<!--
.style2 {font-weight: bold}
-->
</style>
</head>

<body>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="150" height="125" valign="top"><img src="images/caduceus.gif" alt="" name="LogoLeft" width="150" height="125" id="LogoLeft" style="background-color: #0033FF" /></td>
    <td width="692" align="center" valign="middle"><h1 align="center">CADUCEUS HOSPITAL </h1></td>
    <td width="157" valign="top"><img src="images/hospital.jpg" alt="" name="LogoRight" width="150" height="125" id="LogoRight" style="background-color: #0033FF" /></td>
  </tr>
  <tr>
    <td height="19" colspan="2" valign="top">Welcome <%=session.getAttribute("Name")%>&nbsp;<%=new java.util.Date() %>
	<td align="right"><a href="home.jsp" title="Logout">Logout</a></td>
  </tr>
</table>
<%
String visitId = request.getParameter("vId").toString();
String callerId = request.getParameter("callerId");
%>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width ="180" valign="top" class="style2"><p>Quicklinks</p>
     <%
    	Login lgn = new Login();
    	ResultSet rs;
    	int apptId = 0;
    	String diagnosis = "unknown";
    	String prescription = "unknown";
    	String dosage = "unknown";
    	String comments = "unknown";
        String Caller ="unknown";
    	
    	if (callerId.equals("patient2appt") || callerId.equals("patientSearchforFinance"))
    	{
    		rs = lgn.getVisitDetails("Patient",Integer.parseInt(visitId));
            if (callerId.equals("patient2appt"))
            	Caller = "patient";
            
            else
            	Caller = "finance";
    	}
    	else
    	{
    		rs = lgn.getVisitDetails("Staff",Integer.parseInt(visitId));
            Caller = "staff";
    	}
    	
    	if (rs != null)
    	{
    		while (rs.next())
    		{
    			apptId = Integer.parseInt(rs.getString("AppointmentId"));
    			diagnosis = rs.getString("Diagnosis");
    			prescription = rs.getString("Prescription");
    			dosage = rs.getString("Dosage");
    			comments = "N/A"; //should not be seen by patients
    		}
    	}
    	
    	%>
           <p><a href="#www.webmd.com">WebMD</a></p>
            <%
              String target = Caller + "Home.jsp";
            %>
            <p><a href=<%=target%>>Back to Homepage</a></p>
            <p>&nbsp;</p></td>
    <td width="740" rowspan="2" class="style2", valign="top"><h3 align="left"><strong>Visitation Information </strong></h3>
    <table width="648">
		<tr>
			<td width="117"><strong>
			  Appointment ID					</strong></td>
	    <td width="519"><input name="txtAppointmentID" type="text" id="txtAppointmentID" value=<%=apptId %> readonly />		</tr>
				
		<tr>
			<td height="68"><strong>
			  Diagnosis
			</strong></td>
			<td><form id="frmDiagnosis" name="frmDiagnosis" method="post" action="">
              <textarea name="txtDiagnosis" cols="80" rows="5" id="txtDiagnosis" readonly><%=diagnosis%></textarea>
            </form></td>
		</tr>
				
		<tr>
			<td height="73"><strong>
			  Prescription
			</strong></td>
			<td><form id="frmPrescription" name="frmPrescription" method="post" action="">
			  <textarea name="txtPrescription" cols="80" rows="5" id="txtPrescription" readonly><%=prescription%></textarea>
			</form></td>
		</tr>
				
		<tr>
			<td height="62"><strong>
			  Dosage
			</strong></td>
			<td><form id="frmDosage" name="frmDosage" method="post" action="">
              <textarea name="txtDosage" cols="80" rows="5" id="txtDosage" readonly><%=dosage%></textarea>
            </form></td>
		</tr>
				
		<tr>
			<td height="91"><strong>
			  Comments
			</strong></td>
			<td><form id="frmComments" name="frmComments" method="post" action="">
              <textarea name="txtComments" cols="80" rows="5" id="txtComments" readonly><%=comments%></textarea>
            </form>			</td>
		</tr>
	</table></td>
  </tr>
</table>
</body>
</html>
